﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMaster.Master" AutoEventWireup="true"
    CodeBehind="UserAuditList.aspx.cs" Inherits="ExpertMIS.Admin.UserAuditList" %>

<%@ Register Src="UserControl/AuditPagingGridView.ascx" TagName="AuditPagingGridView"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script src="../js/jquery-1.3.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
             function setSearch(){
                // 判断用户姓名查询条件是否非空
                var userName = $("#<%=txUserName.ClientID %>").val();
                var selectValue = $("#<%=ddlIsPassed.ClientID %>").val();
                var account = $("#<%=txAccount.ClientID %>").val();
                var email = $("#<%=txEmail.ClientID %>").val();
                
                var search = "1=1";
                if (userName && userName != "") {
                    search = search + " AND F_Name like '%" + userName + "%'";
                }
                if (selectValue != 'all') {
                    if (selectValue == 'true') {
                        search = search + ' AND F_IsPassed = 1'
                    } else {
                        search = search + ' AND F_IsPassed = 0'
                    }
                }
                
                if(account && account != ""){
                   search = search + " AND F_Account like '%" + account + "%'";
                }
                
                if(email && email != ""){
                   search = search + " AND F_Email like '%" + email + "%'";
                }
                
                // 重新设置window.location.href,否则form.submit时QueryString会覆盖Form中的search hidden field value
                var href = window.location.href;
                var index = href.indexOf("?");
                if (index > 0) {
                    href = href.substring(0, index);
                }
                
                $("form.first").attr("action", href);
                // 保存查询条件
                $("#search").val(search);
                    
                return search;
            }
        
            $('#<%=lbQuery.ClientID %>').click(function() {
                setSearch();
                
                // 初始化分页参数为第一页
                $("#<%=GetStartHiddenFieldClientID()%>").val(1);
                
                // 手工提交表单
                $("form.first").submit();
            });
            
            $(".prePage,.nextPage,.Delete,.Audit").click(function(){
                setSearch();
            })
            
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="width: 95%;">
        <table style="font-size: 8pt; width:693px;">
            <tr>
                <td style="text-align: left">
                    <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
                    <tr>
                     <td>
                                账号</td>
                            <td>
                                <asp:TextBox ID="txAccount" runat="server" Width="170px"></asp:TextBox>
                            </td>
                            <td>
                                Email
                            </td>
                            <td>
                                <asp:TextBox ID="txEmail" runat="server" Width="170px"></asp:TextBox>
                            </td><td></td></tr>
                        <tr>
                            <td>
                                用户姓名</td>
                            <td>
                                <asp:TextBox ID="txUserName" runat="server" Width="170px"></asp:TextBox>
                            </td>
                            <td>
                                用户状态
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlIsPassed" runat="server" Width="172px">
                                    <asp:ListItem Selected="True" Value="all">所有用户</asp:ListItem>
                                    <asp:ListItem Value="false">待审核用户</asp:ListItem>
                                    <asp:ListItem Value="true">已审核用户</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td  valign="middle">
                    &nbsp; |&nbsp;<asp:Button ID="lbQuery" runat="server" c
                          Text="查询"></asp:Button>
                            </td>
                        </tr>
                        </table>
                </td>
            </tr>
            </table>
    </div>
    <input type="hidden" id="search" name="search" />
    <div style="height: 10px; width:95%;">
        <uc1:AuditPagingGridView ID="pgvUsers" runat="server" />
    </div>
</asp:Content>
